package com.doubao.wechat.config;

import com.doubao.wechat.interceptor.OAuthStateInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Web 配置，用于注册 OAuth 拦截器
 */
@Configuration
public class WechatWebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 为 OAuth 回调添加状态验证拦截器
        registry.addInterceptor(new OAuthStateInterceptor())
                .addPathPatterns("/oauth/callback");
    }
}